<form id="field_add-form" class="field_add-form form-horizontal" role="form" data-toggle="validator" method="POST"
      action="">
    {if $Think.get.aid}
    <input type="hidden" name="row[zone_id]" value="{$Think.get.aid}">
    {else /}
    <div class="form-group">
        <label for="c-aid" class="control-label col-xs-12 col-sm-2">{:__('广告位')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-aid" data-rule="required" data-source="adzone/index" class="form-control selectpage"
                   name="row[zone_id]" type="text" value="">
        </div>
    </div>
    {/if}

    <div class="form-group form-input form-input-title">
        <label class="control-label col-xs-12 col-sm-2">广告标题：</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-name" class="form-control form-control" placeholder="请输入广告内容的标题"
                   name="row[title]" type="text" value="">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">广告图片：</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-imageurl" class="form-control" size="50" name="row[image]"
                       type="text" value="">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="plupload-imageurl" class="btn btn-danger plupload"
                                  data-input-id="c-imageurl"
                                  data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp"
                                  data-multiple="false" data-preview-id="p-imageurl"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-imageurl" class="btn btn-primary fachoose"
                                  data-input-id="c-imageurl" data-mimetype="image/*" data-multiple="false"><i
                            class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-imageurl"></span>
            </div>
            <ul class="row list-inline plupload-preview" id="p-imageurl"></ul>
        </div>
    </div>

    <div class="form-group form-input">
        <label class="control-label col-xs-12 col-sm-2">落地：</label>
        <div class="col-xs-12 col-sm-8">
            {:build_radios('row[betype]', ['user'=>'用户页面','url'=>'链接'], 'user')}
        </div>
    </div>

    <div class="url-type-group" style="display: none">
        <div class="form-group form-input">
            <label class="control-label col-xs-12 col-sm-2">跳转URL：</label>
            <div class="col-xs-12 col-sm-8">
                <input data-rule="required(isUrl)" class="form-control form-control" placeholder="请输入广告跳转的URL"
                       name="row[url]" type="text" value="#">
            </div>
        </div>
    </div>
    <div class="user-type-group" style="display: none">
        <div class="form-group form-input">
            <label class="control-label col-xs-12 col-sm-2">用户：</label>
            <div class="col-xs-12 col-sm-8">
                <div class="input-group">
                    <input class="form-control" data-rule="required(isUser)" id="search_user" placeholder="搜索用户"
                           type="text" value="">
                    <span class="input-group-btn">
                        <button class="btn btn-default" type="button">搜索</button>
                    </span>
                </div>
                <input name="row[user_id]" type="hidden" value="">
            </div>
        </div>
        <div class="form-group form-input select-betype">
            <label class="control-label col-xs-12 col-sm-2"></label>
            <div class="col-xs-12 col-sm-8">
                {:build_radios('row[user_page_type]', ['demand'=>'需求', 'goods'=>'服务', 'shop'=>'店铺', 'home'=>'主页'],
                'demand')}
            </div>
        </div>

        <div class="demand-betype-group">
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">需求：</label>
                <div class="col-xs-12 col-sm-8">
                    <input data-rule="required(isDemand)" data-source="demand/index" data-field="title"
                           data-pagination="true" data-page-size="10" class="form-control select-be"
                           name="row[demand_id]" type="text" value="" placeholder="请选择用户的需求"
                    >
                </div>
            </div>
        </div>

        <div class="goods-betype-group">
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">服务：</label>
                <div class="col-xs-12 col-sm-8">
                    <input data-rule="required(isGoods)" data-source="goods/index" data-field="title"
                           data-pagination="true" data-page-size="10" class="form-control select-be"
                           name="row[goods_id]" type="text" value="" placeholder="请选择用户的服务">
                </div>
            </div>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">生效时间：</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-effectime" data-rule="required" class="form-control datetimepicker"
                   data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[effectime]" type="text"
                   value="{:date('Y-m-d H:i:s')}">
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">有效期：</label>
        <div class="col-xs-12 col-sm-8">
            {:build_radios('row[expire]', ['forever'=>'长期', 'time'=>'指定时间'], 'forever')}
        </div>
    </div>
    <div class="form-group expire-time-field" style="display: none">
        <label class="control-label col-xs-12 col-sm-2">到期时间：</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-expiretime" data-rule="required(isExpireTime)" class="form-control datetimepicker"
                   data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[expiretime]" type="text"
                   value="{:date('Y-m-d H:i:s',time()+30*24*3600)}">
        </div>
    </div>

    <div class="form-group form-input form-input-weigh">
        <label class="control-label col-xs-12 col-sm-2">权重：</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-table" class="form-control form-control" placeholder="" name="row[weigh]"
                   type="number" value="">
        </div>
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed ">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>